import request from "@/utils/request";

// 查询订单项目列表
export function listItem(query) {
  return request({
    url: "/admin/order/selectPageOrder",
    method: "get",
    params: query,
  });
}

// 查询售后订单列表
export function getAfterSalesList(query) {
  return request({
    url: "/admin/sales/queryAfterSalesList",
    method: "get",
    params: query,
  });
}

// 批量退款
export function confirmRefund(data) {
  return request({
    url: "/admin/sales/confirmationOfRefund",
    method: "post",
    data: data,
  });
}

// 查询订单项目详细
export function getItem(id) {
  return request({
    url: `/admin/order/orderDetails?orderId=${id}`,
    method: "get",
  });
}

// 新增订单项目
export function addItem(data) {
  return request({
    url: "/system/item",
    method: "post",
    data: data,
  });
}

// 修改订单项目
export function updateItem(data) {
  return request({
    url: "/system/item",
    method: "put",
    data: data,
  });
}

// 删除订单项目
export function delItem(id) {
  return request({
    url: "/system/item/" + id,
    method: "delete",
  });
}

export function deleteOrder(data) {
  return request({
    url: "/admin/order/deleteOrder",
    method: "post",
    data: data,
  });
}

export function receivingGoods(id) {
  return request({
    url: `/system/order/receivingGoods?orderId=${id}`,
    method: "get",
  });
}

/**查询订单日志 */
export function shipmentsList(id) {
  return request({
    url: `/system/shipments/list?soId=${id}`,
    method: "get",
  });
}

/**根据订单号查询订单轨迹 */
export function getOrderPhysicalDistribution(id) {
  return request({
    url: `/admin/order/getOrderPhysicalDistribution?orderId=${id}`,
    method: "get",
  });
}

// 订单发货
export function updateOrder(data) {
  return request({
    url: "/admin/order",
    method: "put",
    data,
  });
}
